<div appBsModal #editModal="bs-modal" class="modal fade" [ngClass]="modalExpandOb.className" tabindex="-1" role="dialog"
    aria-labelledby="editModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <form #flowForm="ngForm" novalidate (ngSubmit)="save()">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="flowWorkId">{{'Edit' | localize}}{{flowWorkId}}</span>
                        <span *ngIf="!flowWorkId">{{'Create' | localize}}</span>
                    </h4>
                    <span class="pull-right">
                        <a class="btn btn-smallEx" (click)='modalExpandOb.modalExHandle("small")'>
                            <i class="bi bi-arrows-angle-expand" *ngIf="!modalExpandOb.isSmallEx"></i>
                            <i class="bi bi-arrows-angle-contract" *ngIf="modalExpandOb.isSmallEx"></i>
                        </a>
                        <a class="btn btn-fullscreen" (click)='modalExpandOb.modalExHandle("full")'>
                            <i class="bi bi-arrows-fullscreen" *ngIf="!modalExpandOb.isFullScreen"></i>
                            <i class="bi bi-fullscreen-exit" *ngIf="modalExpandOb.isFullScreen"></i>
                        </a>
                        <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                            [disabled]="saving">
                            <i aria-hidden="true" class="bi bi-x"></i>
                        </button>
                    </span>
                  
                </div>
                <div class="modal-body">
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>{{'Name' | localize}}</label>
                        <input class="form-control" type="text" name="name" [(ngModel)]="fields.name"  required  />
                    </div>
        
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>简称</label>
                        <input class="form-control" type="text" name="shortName" [(ngModel)]="fields.shortName"  />
                    </div>
        
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>唯一标识名（可能在代码中用到，不要修改）</label>
                        <input class="form-control" type="text" name="uniqueName" required [(ngModel)]="fields.customData.uniqueName"  />
                    </div>
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>流程类别</label>
                        <select class="form-control edited" [(ngModel)]="fields.categeoryId" required name="categeoryId">
                            <option value="">请选择</option>
                            <option *ngFor="let type of flowCategory"  value="{{type.id}}">{{type.name}}</option>
                        </select>
                       
                    </div>
        
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>委托类型</label>
                        <select class="form-control edited" [(ngModel)]="fields.entrustType" name="entrustType">
                            <option value="0">自由委托</option>
                            <option value="1">按步骤设置的经办权限委托</option>
                            <option value="2">按实际经办人委托</option>
                            <option value="3">禁止委托</option>
                        </select>
                    </div>
        
                    <div class="form-group">
                        <label>流程说明</label>
                        <ckeditor [(data)]="fields.description"></ckeditor>
                    </div>
        
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>文号格式</label>
                        <input class="form-control" type="text" name="numberFormat"  [(ngModel)]="fields.numberFormat" />
                    </div>
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <input class="form-control edited" type="number" name="digitNumber" [(ngModel)]="fields.digitNumber" />
                        <label>自动编号的位数</label>
                    </div>
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>自动编号的当前计数</label>
                        <input class="form-control edited" type="number" name="numberCounting" [(ngModel)]="fields.numberCounting" />
                    </div>
                    <!--部门-->
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-6">
                                <label>部门选择&nbsp;</label>
                                <a role="button" class="btn btn-xs2 btn-circle" (click)="selectionUnits()"><i class="fa fa-plus"></i>添加</a>
                            </div>
                            <div class="col-sm-6"></div>
                        </div>
                        <textarea class="form-control" [(ngModel)]="fields.unitNames" name="unitNames" rows="4" disabled></textarea>
                    </div>
        
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>{{'Order' | localize}}</label>
                        <input type="number" class="form-control edited" name="order" [(ngModel)]="fields.order">

                    </div>
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>默认标题格式</label>
                        <input type="text" class="form-control"  name="defaultTitleFormat" [(ngModel)]="fields.customData.defaultTitleFormat">
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="form-group form-md-line-input form-md-floating-label no-hint">
                                <label>自定义插件</label>
                                <select class="form-control edited" [(ngModel)]="fields.optionFunction" name="optionFunction">
                                    <option value="">请选择</option>
                                    <option *ngFor="let type of functions"  value="{{type.value}}">{{type.name}}</option>
                                </select>
                               
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="md-checkbox-list">
                                <div class="md-checkbox">
                                    <input id="isApprovalFlow" class="md-check" type="checkbox" name="isApprovalFlow" [(ngModel)]="fields.customData.isApprovalFlow">
                                    <label for="isApprovalFlow">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        是否审批流程（提交按钮显示为同意）
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="md-checkbox-list">
                                <div class="md-checkbox">
                                    <input id="ShouldLogWhenDrawback" class="md-check" type="checkbox" name="shouldLogWhenDrawback" [(ngModel)]="fields.shouldLogWhenDrawback">
                                    <label for="ShouldLogWhenDrawback">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        撤回记录日志
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="md-checkbox-list">
                                <div class="md-checkbox">
                                    <input id="IsActive" class="md-check" type="checkbox" name="isActive" [(ngModel)]="fields.isActive">
                                    <label for="IsActive">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        是否发布
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="md-checkbox-list">
                                <div class="md-checkbox">
                                    <input id="IsHaveOnlineWord" class="md-check" type="checkbox" name="isHaveOnlineWord" [(ngModel)]="fields.isHaveOnlineWord">
                                    <label for="IsHaveOnlineWord">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        是否在线编辑
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="md-checkbox-list">
                                <div class="md-checkbox">
                                    <input id="IsHaveAttachment" class="md-check" type="checkbox" name="isHaveAttachment" [(ngModel)]="fields.isHaveAttachment">
                                    <label for="IsHaveAttachment">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        是否可上传附件
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-light-primary font-weight-bold"
                        (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" class="btn btn-primary font-weight-bold"
                        [disabled]="!flowForm.form.valid" [buttonBusy]="saving"
                        [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>

<selection-unit-box #selectUnitModal (selectUnitModalSave)="selectUnitBackData($event)"></selection-unit-box>
